package com.example.androidshixi;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;

public class SettingsActivity extends AppCompatActivity {
    private UserSessionManager sessionManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);

        sessionManager = new UserSessionManager(this);

        TextView accountManagementTextView = findViewById(R.id.account_management_text_view);
        TextView logoutTextView = findViewById(R.id.logout_text_view);
        TextView adminModeTextView = findViewById(R.id.admin_mode_text_view);

        accountManagementTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SettingsActivity.this, AccountManagementActivity.class);
                startActivity(intent);
            }
        });

        logoutTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                sessionManager.logoutUser();
                Intent intent = new Intent(SettingsActivity.this, LoginActivity.class);
                startActivity(intent);
                finish();
            }
        });

        adminModeTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // 实现管理员模式逻辑
            }
        });
    }
}